package com.xxd.spring.boot.demo.lihonghai.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xxd.spring.boot.demo.lihonghai.Result;
import com.xxd.spring.boot.demo.lihonghai.entity.Grade;
import com.xxd.spring.boot.demo.lihonghai.entity.StudentCurriculumFraction;
import com.xxd.spring.boot.demo.lihonghai.service.GradeService;
import com.xxd.spring.boot.demo.lihonghai.service.StudentCurriculumFractionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/studentcurriculumfraction")
public class StudentCurriculumFractionController {
    @Autowired
    private StudentCurriculumFractionService studentCurriculumFractionService;
    @RequestMapping("/add")
    public Result add(@RequestBody StudentCurriculumFraction studentCurriculumFraction)
    {
        studentCurriculumFractionService.add(studentCurriculumFraction);
        return new Result().success();
    }

    @RequestMapping("/update")
    public Result update(@RequestBody StudentCurriculumFraction studentCurriculumFraction)
    {
        studentCurriculumFractionService.update(studentCurriculumFraction);
        return new Result().success();
    }

    @RequestMapping("/delete/{id}")
    public Result delete(@PathVariable("id") Integer id)
    {
        studentCurriculumFractionService.delete(id);
        return new Result().success();
    }

    @RequestMapping("/listpage")
    public Result listpage(Page page, @RequestParam Map<String,Object> params)
    {
        IPage<StudentCurriculumFraction> respage=studentCurriculumFractionService.listpage(page,params);
        return new Result().success().setData(respage);
    }

    @RequestMapping("/list")
    public Result list(@RequestBody Map<String,Object> params)
    {
        List<StudentCurriculumFraction> list=studentCurriculumFractionService.list(params);
        return new Result().success().setData(list);
    }
}
